package org.example.score.controller;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import jakarta.servlet.http.HttpServletRequest;
import org.example.score.domain.*;
import org.example.score.mapper.CalculateScoreMapper;
import org.example.score.mapper.ScoreMapper;
import org.example.score.service.WeightService;
import org.example.score.service.xiangxi.XiangXiService;
import org.example.util.result.Parameter;
import org.example.util.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.CompletableFuture;

import static org.example.TOOL.ExcelExporter.exportToExcel;

@RestController
public class ScoreController {
    @Autowired
    private ScoreMapper scoreMapper;

    @Autowired
    private CalculateScoreMapper calculateScoreMapper;


    private static long PAST = 0;


    @CrossOrigin(origins = "http://localhost:5173")
    @PostMapping("/scores")
    public List<Result> getScore(@RequestBody List<Parameter> list) {
        long now = System.currentTimeMillis();
        if (!(PAST - now >= 650 || PAST == 0)) {
            return null;
        }
        String year = "2023";
        if (list.isEmpty()) {
            System.out.println("list为空");
            return null;
        }
        System.out.println("list:" + list);

        List<String> schoolCode = new ArrayList<>();
        String majorName = list.get(0).getMajor();
        for (Parameter parameter : list) {
            schoolCode.add(parameter.getSchool());
        }
        System.out.println("----------------------------");
        System.out.println("schoolCode:" + schoolCode);
        List<Result> results = scoreMapper.getSchoolMajor(year, schoolCode, majorName);
        System.out.println("results:" + results);
        List<Result> list1 = setResult(schoolCode, majorName);


        List<Result> exelDta = updateResult(list1, majorName);
        //在这里用用户token存储就能实现，多用户互不打扰提供下载Exel文件
        exelDtas.put("123456", exelDta);
        return exelDta;
    }

    private static Map<String, List<Result>> exelDtas = new HashMap<>();
    public static Integer ZHIBIAOSHU = 26;
    public static double flagdefault = -88.0;
    public static Map<Integer, Integer> yxzbsMap = new HashMap<>();


    public static List<Result> computeWeight1(List<Result> resul, Map<Integer, Double> weights) {

        List<Result> result = new ArrayList<>();

        int zhibiaoflag = 0;
        for (Result res : resul) {
            double sum = 0.0;
            zhibiaoflag++;
            // 计算指标权重
            yxzbsMap.put(zhibiaoflag, 0);
            sum += safeMultiply(res.getLqfs(), weights.get(1), zhibiaoflag); // 录取分数
            sum += safeMultiply(res.getDyzyl(), weights.get(2), zhibiaoflag); // 第一志愿率
            sum += safeMultiply(res.getBdl(), weights.get(3), zhibiaoflag); // 报到率
            sum += safeMultiply(res.getYsylzy(), weights.get(4), zhibiaoflag); // 优势一流专业
            sum += safeMultiply(res.getZzyqk(), weights.get(5), zhibiaoflag); // 转专业情况
            sum += safeMultiply(res.getZymyd(), weights.get(6), zhibiaoflag); // 专业满意度
            sum += safeMultiply(res.getGccch(), weights.get(7), zhibiaoflag); // 高层次称号
            sum += safeMultiply(res.getGcctd(), weights.get(8), zhibiaoflag); // 高层次团队
            sum += safeMultiply(res.getSljg(), weights.get(9), zhibiaoflag); // 数量结果
            sum += safeMultiply(res.getJxsp(), weights.get(10), zhibiaoflag); // 教学水平
            sum += safeMultiply(res.getKysp(), weights.get(11), zhibiaoflag); // 科研水平
            sum += safeMultiply(res.getSyjx(), weights.get(12), zhibiaoflag); // 实验教学
            sum += safeMultiply(res.getSxsjsxjdqk(), weights.get(13), zhibiaoflag); // 实习实践实训基地
            sum += safeMultiply(res.getYlkcjs(), weights.get(14), zhibiaoflag); // 一流课程建设
            sum += safeMultiply(res.getCbjczl(), weights.get(15), zhibiaoflag); // 出版教材质量
            sum += safeMultiply(res.getXxhkcjs(), weights.get(16), zhibiaoflag); // 信息化课程建设
            sum += safeMultiply(res.getGyxljyhdcyqk(), weights.get(17), zhibiaoflag); // 高影响力教育活动参与情况
            sum += safeMultiply(res.getXxcx(), weights.get(18), zhibiaoflag); // 学习成效
            sum += safeMultiply(res.getLwcjhgl(), weights.get(19), zhibiaoflag); // 论文抽检合格率
            sum += safeMultiply(res.getByzhxlqk(), weights.get(20), zhibiaoflag); // 毕业综合训练情况
            sum += safeMultiply(res.getJyl(), weights.get(21), zhibiaoflag); // 就业率
            sum += safeMultiply(res.getKyl(), weights.get(22), zhibiaoflag); // 考研率
            sum += safeMultiply(res.getJyqx(), weights.get(23), zhibiaoflag); // 就业去向
            sum += safeMultiply(res.getJyyzyxgd(), weights.get(24), zhibiaoflag); // 就业与专业规划
            sum += safeMultiply(res.getSsb(), weights.get(25), zhibiaoflag); // 师生比
            sum += safeMultiply(res.getZsjhs(), weights.get(26), zhibiaoflag); // 招生计划数

            res.setYxzbs(ZHIBIAOSHU - yxzbsMap.get(zhibiaoflag)); // 有效指标数据

            System.out.println("学校名称：" + res.getXxmc() + "zymc:" + res.getZymc() + "有效指标数据：" + (ZHIBIAOSHU - yxzbsMap.get(zhibiaoflag)) + "总分：" + res.getFzzs() + "平均分：" + sum);

            // 计算平均分并保留四位小数
            //  sum = sum / (ZHIBIAOSHU - res.getYxzbs());   发生了无法想象的错误，导致计算结果不准确，所以在前端计算
            res.setFzzs(sum); // 设置总分

            // 对所有字段保留四位小数
            try {
                res.setLqfs(roundToFourDecimalPlaces(res.getLqfs()));
                res.setDyzyl(roundToFourDecimalPlaces(res.getDyzyl()));
                res.setBdl(roundToFourDecimalPlaces(res.getBdl()));
                res.setYsylzy(roundToFourDecimalPlaces(res.getYsylzy()));
                res.setZzyqk(roundToFourDecimalPlaces(res.getZzyqk()));
                res.setZymyd(roundToFourDecimalPlaces(res.getZymyd()));
                res.setGccch(roundToFourDecimalPlaces(res.getGccch()));
                res.setGcctd(roundToFourDecimalPlaces(res.getGcctd()));
                res.setSljg(roundToFourDecimalPlaces(res.getSljg()));
                res.setJxsp(roundToFourDecimalPlaces(res.getJxsp()));
                res.setKysp(roundToFourDecimalPlaces(res.getKysp()));
                res.setSyjx(roundToFourDecimalPlaces(res.getSyjx()));
                res.setSxsjsxjdqk(roundToFourDecimalPlaces(res.getSxsjsxjdqk()));
                res.setYlkcjs(roundToFourDecimalPlaces(res.getYlkcjs()));
                res.setCbjczl(roundToFourDecimalPlaces(res.getCbjczl()));
                res.setXxhkcjs(roundToFourDecimalPlaces(res.getXxhkcjs()));
                res.setGyxljyhdcyqk(roundToFourDecimalPlaces(res.getGyxljyhdcyqk()));
                res.setXxcx(roundToFourDecimalPlaces(res.getXxcx()));
                res.setLwcjhgl(roundToFourDecimalPlaces(res.getLwcjhgl()));
                res.setByzhxlqk(roundToFourDecimalPlaces(res.getByzhxlqk()));
                res.setJyl(roundToFourDecimalPlaces(res.getJyl()));
                res.setKyl(roundToFourDecimalPlaces(res.getKyl()));
                res.setJyqx(roundToFourDecimalPlaces(res.getJyqx()));
                res.setJyyzyxgd(roundToFourDecimalPlaces(res.getJyyzyxgd()));
                res.setSsb(roundToFourDecimalPlaces(res.getSsb()));
                res.setZsjhs(roundToFourDecimalPlaces(res.getZsjhs()));
                res.setFzzs(roundToFourDecimalPlaces(res.getFzzs()));
            } catch (Exception e) {
                System.out.println("保留四位小数异常：" + e.getMessage());
            }
            result.add(res);
        }
        System.out.println(yxzbsMap.toString());
        return result;
    }

    // 辅助方法：将数字保留到小数点后四位
    private static double roundToFourDecimalPlaces(Double value) {
        if (value == 0) {
            return 0.0; // 如果值为 0，直接返回 0.0
        }
        BigDecimal bd = new BigDecimal(value);
        bd = bd.setScale(4, RoundingMode.HALF_UP); // 四舍五入保留四位小数
        return bd.doubleValue();
    }

    private static double safeMultiply(Double value, Double multiplier, Integer flag) {
        if (multiplier == null || multiplier == 0.0) {
            throw new IllegalArgumentException("权重 不能为0");
        } else if (value == null) {
           // throw new IllegalArgumentException("得分 不能为0");
            return 0.0;
        } else if (value == flagdefault) {
            yxzbsMap.put(flag, yxzbsMap.get(flag) + 1);
            return 0.0;
        } else {
            return value * multiplier;
        }
    }


    int cnnt = 0;
    public List<Result> updateResult(List<Result> resul, String major) {

        Map<Integer, Double> weights = weightService.getweightNumber(major);
        List<Result> result = computeWeight1(resul, weights);

        result = filterByMaxYxzbs(result);

        Gson gson = new Gson();
        String json1 = gson.toJson(result);//生成json字符串
        System.out.println(json1);
        System.out.println("\n"+(++cnnt)+"====================================\n"+json1+"\n====================================");


        return result;
    }

    private static Double LING = 0.0;

    public static List<Result> filterByMaxYxzbs(List<Result> dataList) {
        Map<String, Result> resultMap = new HashMap<>();
        for (Result data : dataList) {
            String key = data.getXxdm(); // 使用学校代码作为key
            if (!resultMap.containsKey(key) || data.getYxzbs() > resultMap.get(key).getYxzbs()) {
                resultMap.put(key, data);
            }
        }
        return new ArrayList<>(resultMap.values());
    }



    List<Result> setResult(List<String> schoolCode, String majorName) {
        String year = "2023";
        List<Result> results = scoreMapper.getSchoolMajor(year, schoolCode, majorName);
        if (results != null && !results.isEmpty()) {
            // List<Lqfs> lqfss = scoreMapper.getLqfs(year, results); //录取分数   没有数据
            //List<Zsjhs> zsjhss = scoreMapper.getZsjhs(year, results);//招生计划数  没有数据
            List<Dyzyl> dyzyls = scoreMapper.getDyzyl(year, results);//第一志愿率
            List<Bdl> bdls = scoreMapper.getBdl(year, results);//报到率

            List<Ysylzy> ysylzys = scoreMapper.getYsylzy(year, results);//优势一流专业
            List<Zzyqk> zzyqks = scoreMapper.getZzyqk(year, results);//转专业情况
            List<Zymyd> zymyds = scoreMapper.getZymyd(year, results);//专业满意度 *

            List<Gccch> gccchs = scoreMapper.getGccch(year, results); //高层次称号
            List<Gcctd> gcctds = scoreMapper.getGcctd(year, results); //高层次团队

            List<SljgZjb> sljgZjbs = scoreMapper.getSljgZjb(year, results); //数量结构
            List<Map<String, Object>> ssbList = scoreMapper.getSsb(year, results);//师生比
            List<JxspZjb> jxspZjbs = scoreMapper.getJxspZjb(year, results);//教学水平
            List<KyspZjb> kyspZjbs = scoreMapper.getKyspZjb(year, results);        //科研水平

            List<SxjdZjb> sxjdZjbs = scoreMapper.getSxjdZjb(year, results); //实践基地
            List<Zysyjxxncsqk> zysyjxxncsqks = scoreMapper.getZysyjxxncsqk(year, results);        //专业实验教学校内场所情况

            List<Ylkcjs> ylkcjs = scoreMapper.getYlkcjs(year, results);//一流课程建设
            List<Cbjczl> cbjczls = scoreMapper.getCbjczl(year, results); //出版教材质量
            List<Xxhkcjs> xxhkcjss = scoreMapper.getXxhkcjs(year, results);        //信息化课程建设

            List<JyhdZjb> jyhdZjbs = scoreMapper.getJyhdZjb(year, results);//高影响力教育活动参加情况
            List<Xxcx> xxcxs = scoreMapper.getXxcx(year, results); //学习成效
            //List<Lwcjhgl> lwcjhgls = scoreMapper.getLwcjhgl(year, results); //论文抽检合格率
            List<ByxlZjb> byxlZjbs = scoreMapper.getByxlZjb(year, results);        //毕业综合训练情况

            List<Jyl> jyls = scoreMapper.getJyl(year, results);//就业率
            List<Kyl> kyls = scoreMapper.getKyl(year, results);//考研率
            List<Jyqx> jyqxs = scoreMapper.getJyqx(year, results);//就业去向
            List<Jyyzyxgd> jyyzyxgds = scoreMapper.getJyyzyxgd(year, results);//就业与专业相关度


            //List<Zysy> zysys = scoreMapper.getZysy(year, results);//专业素养    已经被遗弃
            //List<Tynl> tynls = scoreMapper.getTynl(year, results); //通用能力   已经被遗弃


            // 遍历 results 列表，并对每个 Result 对象尝试在其他列表中找到匹配项
            for (Result result : results) {


                // 对于 Lqfs 进行匹配并设置相应的字段
                result.setLqfs(flagdefault);//1.默认设置录取分数     该字段数据都没有，暂时设置为默认值
//                for (Lqfs lqfs : lqfss) {
//                    if (lqfs.getXxdm().equals(result.getXxdm()) && lqfs.getXnzydm().equals(result.getXnzydm())) {
//                        result.setLqfs(lqfs.getZtzydf());
//                        break; // 找到匹配后退出循环
//                    }
//                }

                // 对于 招生计划数 进行匹配并设置相应的字段
                result.setZsjhs(flagdefault);//2.默认设置招生计划数   该字段数据都没有，暂时设置为默认值

                // 对于 第一志愿率 进行匹配并设置相应的字段
                result.setDyzyl(LING);//3.默认设置第一志愿率
                for (Dyzyl dyzyl : dyzyls) {
                    if (dyzyl.getXxdm().equals(result.getXxdm()) && dyzyl.getXnzydm().equals(result.getXnzydm())) {
                        result.setDyzyl(dyzyl.getDyzybl());
                        break;
                    }
                }

                // 对于 报到率 进行匹配并设置相应的字段
                result.setBdl(LING);//4.默认设置报到率
                for (Bdl bdl : bdls) {
                    if (bdl.getXxdm().equals(result.getXxdm()) && bdl.getXnzydm().equals(result.getXnzydm())) {
                        result.setBdl(bdl.getBdl());
                        break;
                    }
                }

                // 对 优势一流专业 进行匹配并设置相应的字段
                result.setYsylzy(LING);//5.默认设置优势一流专业
                for (Ysylzy ysylzy : ysylzys) {
                    if (ysylzy.getXxdm().equals(result.getXxdm()) && ysylzy.getXnzydm().equals(result.getXnzydm())) {
                        result.setYsylzy(ysylzy.getZtzydf());
                        break;
                    }
                }

                // 对 转专业情况 进行匹配并设置相应的字段
                result.setZzyqk(LING);//6.默认设置转专业情况
                for (Zzyqk zzyqk : zzyqks) {
                    if (zzyqk.getXxdm().equals(result.getXxdm()) && zzyqk.getXnzydm().equals(result.getXnzydm())) {
                        result.setZzyqk(zzyqk.getZtzydf());
                        break;
                    }
                }

                // 对 专业满意度 进行匹配并设置相应的字段
                result.setZymyd(flagdefault);//7.默认设置专业满意度
                for (Zymyd zymyd : zymyds) {
                    if (zymyd.getXxdm().equals(result.getXxdm()) && zymyd.getXnzydm().equals(result.getXnzydm())) {
                        result.setZymyd(zymyd.getZtzydf());
                        break;
                    }
                }

                // 对 高层次称号 进行匹配并设置相应的字段
                result.setGccch(LING);//8.默认设置高层次称号
                for (Gccch gccch : gccchs) {
                    if (gccch.getXxdm().equals(result.getXxdm()) && gccch.getZydm().equals(result.getZydm())) {
                        result.setGccch(gccch.getZtzydf());
                    }
                }

                // 对 高层次团队 进行匹配并设置相应的字段
                result.setGcctd(LING);//9.默认设置高层次团队
                for (Gcctd gcctd : gcctds) {
                    if (gcctd.getXxdm().equals(result.getXxdm()) && gcctd.getZydm().equals(result.getZydm())) {
                        result.setGcctd(gcctd.getZtzydf());
                    }
                }
                // 数量结构
                result.setSljg(LING);//10.默认设置数量结构
                for (SljgZjb sljgZjb : sljgZjbs) {
                    if (sljgZjb.getXxdm().equals(result.getXxdm()) && sljgZjb.getZydm().equals(result.getZydm())) {
                        result.setSljg(sljgZjb.getZtzydf());
                    }
                }

                //师生比
                result.setSsb(LING);//11.默认设置师生比
                for (Map<String, Object> ssbItem : ssbList) {
                    if (ssbItem.get("xxdm").equals(result.getXxdm()) && ssbItem.get("xnzydm").equals(result.getXnzydm())) {
                        result.setSsb(Double.parseDouble(ssbItem.get("ztzydf").toString()));
                        break;
                    }
                }

                // 教学水平
                result.setJxsp(LING);//12.默认设置教学水平
                for (JxspZjb jxspZjb : jxspZjbs) {
                    if (jxspZjb.getXxdm().equals(result.getXxdm()) && jxspZjb.getZydm().equals(result.getZydm())) {
                        result.setJxsp(jxspZjb.getZtzydf());
                    }
                }

                //科研水平
                result.setKysp(LING);//13.默认设置科研水平
                for (KyspZjb ylkcjkyspZjbsItem : kyspZjbs) {
                    if (ylkcjkyspZjbsItem.getXxdm().equals(result.getXxdm()) && ylkcjkyspZjbsItem.getZydm().equals(result.getZydm())) {
                        result.setKysp(ylkcjkyspZjbsItem.getZtzydf());
                    }
                }

                System.out.println("该匹配校内场所了  zysyjxxncsqks:" + zysyjxxncsqks);
                int i = 1;


                // 专业实验教学校内场所情况
                result.setSyjx(LING);//14.默认设置专业实验教学校内场所情况
                for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
                    if (zysyjxxncsqk.getXxdm().equals(result.getXxdm()) && zysyjxxncsqk.getZydm().equals(result.getZydm())) {
                        result.setSyjx(zysyjxxncsqk.getZtzydf());
                        System.out.println("设置好了" + result.getSyjx());
                    } else System.out.println("不匹配," + i);
                    i++;
                }
                //实践实训基地情况
                result.setSxsjsxjdqk(LING);//15.默认设置实践基地
                for (SxjdZjb sxjdZjb : sxjdZjbs) {
                    if (sxjdZjb.getXxdm().equals(result.getXxdm()) && sxjdZjb.getZydm().equals(result.getZydm())) {
                        result.setSxsjsxjdqk(sxjdZjb.getZtzydf());
                    }
                }


                // 对 一流课程建设 进行匹配并设置相应的字段
                result.setYlkcjs(LING);//16.默认设置一流课程建设
                for (Ylkcjs ylkcjsItem : ylkcjs) {
                    if (ylkcjsItem.getXxdm().equals(result.getXxdm()) && ylkcjsItem.getZydm().equals(result.getZydm())) {
                        result.setYlkcjs(ylkcjsItem.getZtzydf());
                    }
                }
                // 对 出版教材质量 进行匹配并设置相应的字段
                result.setCbjczl(LING);//17.默认设置出版教材质量
                for (Cbjczl cbjczl : cbjczls) {
                    if (cbjczl.getXxdm().equals(result.getXxdm()) && cbjczl.getZydm().equals(result.getZydm())) {
                        result.setCbjczl(cbjczl.getZtzydf());
                    }
                }
                //信息化课程建设
                result.setXxhkcjs(LING);//18.默认设置信息化课程建设
                for (Xxhkcjs xxhkcjs : xxhkcjss) {
                    if (xxhkcjs.getXxdm().equals(result.getXxdm()) && xxhkcjs.getZydm().equals(result.getZydm())) {
                        result.setXxhkcjs(xxhkcjs.getZtzydf());
                    }
                }


                //高影响力教育活动参加情况
                result.setGyxljyhdcyqk(LING);//19.默认设置高影响力教育活动参加情况
                for (JyhdZjb jyhdZjb : jyhdZjbs) {
                    if (jyhdZjb.getXxdm().equals(result.getXxdm()) && jyhdZjb.getXnzydm().equals(result.getXnzydm())) {
                        result.setGyxljyhdcyqk(jyhdZjb.getZtzydf());
                        break;
                    }
                }
                //学习成效
                result.setXxcx(LING);//20.默认设置学习成效
                for (Xxcx xxcx : xxcxs) {
                    if (xxcx.getXxdm().equals(result.getXxdm()) && xxcx.getXnzydm().equals(result.getXnzydm())) {
                        result.setXxcx(xxcx.getZtzydf());
                        break;
                    }
                }
                //论文抽检合格率
                result.setLwcjhgl(flagdefault);//21.默认设置论文抽检合格率
                //毕业综合训练情况
                result.setByzhxlqk(LING);//22.默认设置毕业综合训练情况
                for (ByxlZjb byxlZjb : byxlZjbs) {
                    if (byxlZjb.getXxdm().equals(result.getXxdm()) && byxlZjb.getXnzydm().equals(result.getXnzydm())) {
                        result.setByzhxlqk(byxlZjb.getZtzydf());
                        break;
                    }
                }


                // 对 就业率 进行匹配并设置相应的字段
                result.setJyl(LING);//23.默认设置就业率
                for (Jyl jyl : jyls) {
                    if (jyl.getXxdm().equals(result.getXxdm()) && jyl.getXnzydm().equals(result.getXnzydm())) {
                        result.setJyl(jyl.getJyl());
                        break;
                    }
                }
                //考研率
                result.setKyl(LING);//24.默认设置考研率
                for (Kyl kyl : kyls) {
                    if (kyl.getXxdm().equals(result.getXxdm()) && kyl.getXnzydm().equals(result.getXnzydm())) {
                        result.setKyl(kyl.getSxl());
                        break;
                    }
                }
                //就业去向
                result.setJyqx(LING);//25.默认设置就业去向
                for (Jyqx jyqx : jyqxs) {
                    if (jyqx.getXxdm().equals(result.getXxdm()) && jyqx.getXnzydm().equals(result.getXnzydm())) {
                        result.setJyqx(jyqx.getQxhbsbl());
                        break;
                    }
                }
                //就业与专业相关度
                result.setJyyzyxgd(flagdefault);//26.默认设置就业与专业相关度
                for (Jyyzyxgd jyyzyxgd : jyyzyxgds) {
                    if (jyyzyxgd.getXxdm().equals(result.getXxdm()) && jyyzyxgd.getXnzydm().equals(result.getXnzydm())) {
                        result.setJyyzyxgd(jyyzyxgd.getZtzydf());
                        break;
                    }
                }


                // 对 专业素养 进行匹配并设置相应的字段
//                for (Zysy zysy : zysys) {
//                    if (zysy.getXxdm().equals(result.getXxdm()) && zysy.getXnzydm().equals(result.getXnzydm())) {
//                        result.setZysy(zysy.getZtzydf());
//                        break;
//                    }
//                }
                // 对 通用能力 进行匹配并设置相应的字段
//                for (Tynl tynl : tynls) {
//                    if (tynl.getXxdm().equals(result.getXxdm()) && tynl.getXnzydm().equals(result.getXnzydm())) {
//                        result.setTynl(tynl.getZtzydf());
//                        break;
//                    }
//                }
            }
        }


        return results;
    }


    @Autowired
    private XiangXiService xiangXiService;


    @CrossOrigin(origins = "http://localhost:5173")
    @GetMapping("/xiangxi")
    public String selectXiangxi(@RequestParam String zhibiao, @RequestParam String code, @RequestParam String xnzymc) {
        System.out.println(zhibiao + "--" + code + "--" + xnzymc);
        return xiangXiService.selectXiangxi(zhibiao, code, xnzymc);
    }


    @Autowired
    private ResourceLoader resourceLoader;


    @CrossOrigin(origins = "http://localhost:5173")
    @GetMapping("/export")
    public ResponseEntity<Resource> download1(HttpServletRequest request) throws IOException {
        // 这里通常会进行 token 验证等操作，但未在此示例中实现
        String token = request.getHeader("Authorization");
        UUID uuid = UUID.randomUUID();


        String filePath = uuid.toString() ;
        System.out.println("开始下载文件: " + filePath);
        try {
            exportToExcel(exelDtas.get("123456"), filePath);
        } catch (Exception e) {
            System.err.println("导出 Excel 文件失败: " + e.getMessage());
            return ResponseEntity.internalServerError().body(null);
        }


        // Path path1 = Paths.get(System.getProperty("user.dir") + "/src/main/java/org/example/TOOL/" + filePath + ".xlsx");
        Path path1 = Paths.get(System.getProperty("user.dir") + "/src/main/resources/files/" + filePath + ".xlsx");
        Resource resource = new FileSystemResource(path1);
        try {

            if (resource.exists() || resource.isReadable()) {
                String contentType = MediaType.APPLICATION_OCTET_STREAM_VALUE;
                System.out.println("准备提供文件下载: " + resource.getFilename());
                return ResponseEntity.ok().contentType(MediaType.parseMediaType(contentType))
                        .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + resource.getFilename() + "\"")
                        .body(resource);
            } else {
                System.err.println("文件不存在或不可读: " + resource.getURL().toString());
                return ResponseEntity.notFound().build();
            }
        } catch (Exception e) {
            System.err.println("文件路径错误: " + resource.getURL().toString());
            return ResponseEntity.badRequest().body(null);
        } finally {
            System.out.println("已经提供文件下载" + resource.getURL().toString());
            // 异步删除文件,3秒后再删除

            CompletableFuture.runAsync(() -> {
                try {
                    Thread.sleep(3000);
                    Files.delete(path1);
                    System.out.println("成功清理临时文件: " + path1);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            });
        }
    }


    @Autowired
    private WeightService weightService;

    @CrossOrigin(origins = "http://localhost:*")
    @GetMapping("/getweight")
    public String getWeight() {
        return weightService.getWeight();
    }


    @CrossOrigin(origins = "http://localhost:*")
    @PostMapping("/setweight")
    public String setWeight(@RequestBody String list) {
        Gson gson = new Gson();
        Type type = new TypeToken<List<Map<String, Object>>>() {
        }.getType();
        List<Map<String, Object>> listMap = gson.fromJson(list, type);// 解析JSON
        System.out.println(listMap.toString());
        System.out.println(listMap.size());
        return weightService.setWeight(listMap);
    }



}










/*


  //    @PostMapping("/scores")
    public void setScore() {
        //  以总分计算,并且有校内专业代码的
        String[] zfXnTable = {"pd_ysylzy", "pd_zymyd", "pd_zysy", "pd_tynl", "pd_xxcx_czbyzp", "pd_xxcx_jsqk", "pd_xxcx_zlzzq", "pd_xxcx_yszybs", "pd_jyyzyxgd"};
//        calculateScore(zfXnTable,"xn");

        //  以总分计算,并且无校内专业代码的，需要按照专业代码去匹配的
//        String[] zfZyTable = {"pd_gccch", "pd_gcctd", "pd_jxsp_jxcgj", "pd_sxjd_jxxmjdqk", "pd_ylkcjs", "pd_cbjczl", "pd_kysp_jskycgzhqk","pd_xxhkcjs"};
//        calculateScoreZf(zfZyTable,"zy");

        calculateScore();
    }


//    计算得分

    public void calculateScoreZf(String[] table, String xnOrZy) {
        String year = "2023";
        List<String> majorCodes = calculateScoreMapper.getAllMajorCode("2023");
        for (String majorCode : majorCodes) {
            for (String tableName : table) {
                Double max = calculateScoreMapper.getZfMax(tableName, majorCode, year);
                Double min = calculateScoreMapper.getZfMin(tableName, majorCode, year);
                if ((max == null || min == null) || (max.equals(min) && max == 0)) {
                    calculateScoreMapper.setScore0(tableName, majorCode, year);
                } else if (max.equals(min)) {
                    calculateScoreMapper.setScore1(tableName, majorCode, year);
                } else {
                    if (xnOrZy.equals("xn")) {
                        List<SchoolMajor> schoolMajors = calculateScoreMapper.getSchoolMajorXnZf(majorCode, tableName, year);
                        for (SchoolMajor schoolMajor : schoolMajors) {
                            if (schoolMajor.getZf() == null) {
                                schoolMajor.setZtzydf(0.0);
                            } else {
                                schoolMajor.setZtzydf((schoolMajor.getZf() - min) / (max - min));
                            }
                        }
                        calculateScoreMapper.setScoreXn(tableName, majorCode, year, schoolMajors);
                    } else if (xnOrZy.equals("zy")) {
                        List<SchoolMajor> schoolMajors = calculateScoreMapper.getSchoolMajorZyZf(majorCode, tableName, year);
                        for (SchoolMajor schoolMajor : schoolMajors) {
                            if (schoolMajor.getZf() == null) {
                                schoolMajor.setZtzydf(0.0);
                            } else {
                                schoolMajor.setZtzydf((schoolMajor.getZf() - min) / (max - min));
                            }
                        }
                        calculateScoreMapper.setScoreZy(tableName, majorCode, year, schoolMajors);
                    }
                }
            }


        }
    }
//        以总分计算,并且无校内专业代码的

    // 非总分的
    public void calculateScore() {
        String year = "2023";
        List<String> majorCodes = calculateScoreMapper.getAllMajorCode("2023");
//        List<String> majorCodes = new ArrayList<>();
//        majorCodes.add("01");

//        // 教学水平 培训进修情况
//        for (String majorCode : majorCodes) {
//            List<JxspPxjxqk> pxjxqks = calculateScoreMapper.getJxspPxjxqk(majorCode, year);
//            if (pxjxqks != null && !pxjxqks.isEmpty()) {
//                //培训进修境内
//                Double maxPxjxjn = calculateScoreMapper.getMax(majorCode, year, "pd_jxsp_pxjxqk", "pxjxjn");
//                Double minPxjxjn = calculateScoreMapper.getMin(majorCode, year, "pd_jxsp_pxjxqk", "pxjxjn");
//                if ((maxPxjxjn == null || minPxjxjn == null) || (maxPxjxjn.equals(minPxjxjn) && maxPxjxjn == 0)) {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        pxjxqk.setPxjxjndf(0.0);
//                    }
//                } else if (maxPxjxjn.equals(minPxjxjn)) {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        pxjxqk.setPxjxjndf(1.0);
//                    }
//                } else {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        if (pxjxqk.getPxjxjn() == null) {
//                            pxjxqk.setPxjxjndf(0.0);
//                        } else {
//                            pxjxqk.setPxjxjndf((pxjxqk.getPxjxjn() - minPxjxjn) / (maxPxjxjn - minPxjxjn));
//                        }
//                    }
//                }
//                //培训交流境外
//                Double maxPxjxjw = calculateScoreMapper.getMax(majorCode, year, "pd_jxsp_pxjxqk", "pxjxjw");
//                Double minPxjxjw = calculateScoreMapper.getMin(majorCode, year, "pd_jxsp_pxjxqk", "pxjxjw");
//                if ((maxPxjxjw == null || minPxjxjw == null) || (maxPxjxjw.equals(minPxjxjw) && maxPxjxjw == 0)) {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        pxjxqk.setPxjxjwdf(0.0);
//                    }
//                } else if (maxPxjxjw.equals(minPxjxjw)) {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        pxjxqk.setPxjxjwdf(1.0);
//                    }
//                } else {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        if (pxjxqk.getPxjxjw() == null) {
//                            pxjxqk.setPxjxjwdf(0.0);
//                        } else {
//                            pxjxqk.setPxjxjwdf((pxjxqk.getPxjxjw() - minPxjxjw) / (maxPxjxjw - minPxjxjw));
//                        }
//                    }
//                }
//
//                //攻读学位博士
//                Double maxBs = calculateScoreMapper.getMax(majorCode, year, "pd_jxsp_pxjxqk", "gdxwbs");
//                Double minBs = calculateScoreMapper.getMin(majorCode, year, "pd_jxsp_pxjxqk", "gdxwbs");
//                if ((maxBs == null || minBs == null) || (maxBs.equals(minBs) && maxBs == 0)) {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        pxjxqk.setGdxwbsdf(0.0);
//                    }
//                } else if (maxBs.equals(minBs)) {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        pxjxqk.setGdxwbsdf(1.0);
//                    }
//                } else {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        if (pxjxqk.getGdxwbs() == null) {
//                            pxjxqk.setGdxwbsdf(0.0);
//                        } else {
//                            pxjxqk.setGdxwbsdf((pxjxqk.getGdxwbs() - minBs) / (maxBs - minBs));
//                        }
//                    }
//                }
//
//                //攻读学位硕士
//                Double maxSs = calculateScoreMapper.getMax(majorCode, year, "pd_jxsp_pxjxqk", "gdxwss");
//                Double minSs = calculateScoreMapper.getMin(majorCode, year, "pd_jxsp_pxjxqk", "gdxwss");
//                if ((maxSs == null || minSs == null) || (maxSs.equals(minSs) && maxSs == 0)) {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        pxjxqk.setGdxwssdf(0.0);
//                    }
//                } else if (maxSs.equals(minSs)) {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        pxjxqk.setGdxwssdf(1.0);
//                    }
//                } else {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        if (pxjxqk.getGdxwss() == null) {
//                            pxjxqk.setGdxwssdf(0.0);
//                        } else {
//                            pxjxqk.setGdxwssdf((pxjxqk.getGdxwss() - minSs) / (maxSs - minSs));
//                        }
//                    }
//                }
//
//                //交流境内
//                Double maxJljn = calculateScoreMapper.getMax(majorCode, year, "pd_jxsp_pxjxqk", "jljn");
//                Double minJljn = calculateScoreMapper.getMin(majorCode, year, "pd_jxsp_pxjxqk", "jljn");
//                if ((maxJljn == null || minJljn == null) || (maxJljn.equals(minJljn) && maxJljn == 0)) {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        pxjxqk.setJljndf(0.0);
//                    }
//                } else if (maxJljn.equals(minJljn)) {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        pxjxqk.setJljndf(1.0);
//                    }
//                } else {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        if (pxjxqk.getJljn() == null) {
//                            pxjxqk.setJljndf(0.0);
//                        } else {
//                            pxjxqk.setJljndf((pxjxqk.getJljn() - minJljn) / (maxJljn - minJljn));
//                        }
//                    }
//                }
//
//                //交流境外
//                Double maxJljw = calculateScoreMapper.getMax(majorCode, year, "pd_jxsp_pxjxqk", "jljw");
//                Double minJljw = calculateScoreMapper.getMin(majorCode, year, "pd_jxsp_pxjxqk", "jljw");
//                if ((maxJljw == null || minJljw == null) || (maxJljw.equals(minJljw) && maxJljw == 0)) {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        pxjxqk.setJljwdf(0.0);
//                    }
//                } else if (maxJljw.equals(minJljw)) {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        pxjxqk.setJljwdf(1.0);
//                    }
//                } else {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        if (pxjxqk.getJljw() == null) {
//                            pxjxqk.setJljwdf(0.0);
//                        } else {
//                            pxjxqk.setJljwdf((pxjxqk.getJljw() - minJljw) / (maxJljw - minJljw));
//                        }
//                    }
//                }
//
//                //企业或生产一线培训
//                Double maxQy = calculateScoreMapper.getMax(majorCode, year, "pd_jxsp_pxjxqk", "qyhscyxpx");
//                Double minQy = calculateScoreMapper.getMin(majorCode, year, "pd_jxsp_pxjxqk", "qyhscyxpx");
//                if ((maxQy == null || minQy == null) || (maxQy.equals(minQy) && maxQy == 0)) {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        pxjxqk.setQyhscyxpxdf(0.0);
//                    }
//                } else if (maxQy.equals(minQy)) {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        pxjxqk.setQyhscyxpxdf(1.0);
//                    }
//                } else {
//                    for (JxspPxjxqk pxjxqk : pxjxqks) {
//                        if (pxjxqk.getQyhscyxpx() == null) {
//                            pxjxqk.setQyhscyxpxdf(0.0);
//                        } else {
//                            pxjxqk.setQyhscyxpxdf((pxjxqk.getQyhscyxpx() - minQy) / (maxQy - minQy));
//                        }
//                    }
//                }
//
//                for (JxspPxjxqk pxjxqk : pxjxqks){
//                    pxjxqk.setZtzydf((pxjxqk.getPxjxjndf()+pxjxqk.getPxjxjwdf()+pxjxqk.getGdxwbsdf()+pxjxqk.getGdxwssdf()
//                            +pxjxqk.getJljndf()+pxjxqk.getJljwdf()+pxjxqk.getQyhscyxpxdf())/7.0);
//                }
//                calculateScoreMapper.setJxspPxjxqk(year, pxjxqks);
//            }
//
//        }

//        // 教学水平 教育教学研究与改革项目
//        for(String majorCode : majorCodes){
//            List<JxspJyjxyjyggxm> jyjxyjyggxms = calculateScoreMapper.getJyjxyjyggxms(majorCode, year);
//
//            if (jyjxyjyggxms != null && !jyjxyjyggxms.isEmpty()) {
//                //省部级项目数
//                Double maxSbjxms = calculateScoreMapper.getMax(majorCode, year, "pd_jxsp_jyjxyjyggxm", "sbjxms");
//                Double minSbjxms = calculateScoreMapper.getMin(majorCode, year, "pd_jxsp_jyjxyjyggxm", "sbjxms");
//                if ((maxSbjxms == null || minSbjxms == null) || (maxSbjxms.equals(minSbjxms) && maxSbjxms == 0)) {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        jyjxyjyggxm.setSbjxmsdf(0.0);
//                    }
//                } else if (maxSbjxms.equals(minSbjxms)) {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        jyjxyjyggxm.setSbjxmsdf(1.0);
//                    }
//                } else {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        if (jyjxyjyggxm.getSbjxms() == null) {
//                            jyjxyjyggxm.setSbjxmsdf(0.0);
//                        } else {
//                            jyjxyjyggxm.setSbjxmsdf((jyjxyjyggxm.getSbjxms() - minSbjxms) / (maxSbjxms - minSbjxms));
//                        }
//                    }
//                }
//
//                //省部级经费
//                Double maxSbjjf = calculateScoreMapper.getMax(majorCode, year, "pd_jxsp_jyjxyjyggxm", "sbjjfwy");
//                Double minSbjjf = calculateScoreMapper.getMin(majorCode, year, "pd_jxsp_jyjxyjyggxm", "sbjjfwy");
//                if ((maxSbjjf == null || minSbjjf == null) || (maxSbjjf.equals(minSbjjf) && maxSbjjf == 0)) {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        jyjxyjyggxm.setSbjjfdf(0.0);
//                    }
//                } else if (maxSbjjf.equals(minSbjjf)) {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        jyjxyjyggxm.setSbjjfdf(1.0);
//                    }
//                } else {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        if (jyjxyjyggxm.getSbjjfwy() == null) {
//                            jyjxyjyggxm.setSbjjfdf(0.0);
//                        } else {
//                            jyjxyjyggxm.setSbjjfdf((jyjxyjyggxm.getSbjjfwy() - minSbjjf) / (maxSbjjf - minSbjjf));
//                        }
//                    }
//                }
//
//                //省部级参与教师人次
//                Double maxSbjjs = calculateScoreMapper.getMax(majorCode, year, "pd_jxsp_jyjxyjyggxm", "sbjcyjssrc");
//                Double minSbjjs = calculateScoreMapper.getMin(majorCode, year, "pd_jxsp_jyjxyjyggxm", "sbjcyjssrc");
//                if ((maxSbjjs == null || minSbjjs == null) || (maxSbjjs.equals(minSbjjs) && maxSbjjs == 0)) {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        jyjxyjyggxm.setSbjcyjssdf(0.0);
//                    }
//                } else if (maxSbjjs.equals(minSbjjs)) {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        jyjxyjyggxm.setSbjcyjssdf(1.0);
//                    }
//                } else {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        if (jyjxyjyggxm.getSbjcyjssrc() == null) {
//                            jyjxyjyggxm.setSbjcyjssdf(0.0);
//                        } else {
//                            jyjxyjyggxm.setSbjcyjssdf((jyjxyjyggxm.getSbjcyjssrc() - minSbjjs) / (maxSbjjs - minSbjjs));
//                        }
//                    }
//                }
//
//                //国家级项目数
//                Double maxGjjxms = calculateScoreMapper.getMax(majorCode, year, "pd_jxsp_jyjxyjyggxm", "gjjxms");
//                Double minGjjxms = calculateScoreMapper.getMin(majorCode, year, "pd_jxsp_jyjxyjyggxm", "gjjxms");
//                if ((maxGjjxms == null || minGjjxms == null) || (maxGjjxms.equals(minGjjxms) && maxGjjxms == 0)) {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        jyjxyjyggxm.setGjjxmsdf(0.0);
//                    }
//                } else if (maxGjjxms.equals(minGjjxms)) {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        jyjxyjyggxm.setGjjxmsdf(1.0);
//                    }
//                } else {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        if (jyjxyjyggxm.getGjjxms() == null) {
//                            jyjxyjyggxm.setGjjxmsdf(0.0);
//                        } else {
//                            jyjxyjyggxm.setGjjxmsdf((jyjxyjyggxm.getGjjxms() - minGjjxms) / (maxGjjxms - minGjjxms));
//                        }
//                    }
//                }
//                //国家级经费
//                Double maxgJjjf = calculateScoreMapper.getMax(majorCode, year, "pd_jxsp_jyjxyjyggxm", "Gjjjfwy");
//                Double minGjjjf = calculateScoreMapper.getMin(majorCode, year, "pd_jxsp_jyjxyjyggxm", "Gjjjfwy");
//                if ((maxgJjjf == null || minGjjjf == null) || (maxgJjjf.equals(minGjjjf) && maxgJjjf == 0)) {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        jyjxyjyggxm.setGjjjfdf(0.0);
//                    }
//                } else if (maxgJjjf.equals(minGjjjf)) {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        jyjxyjyggxm.setGjjjfdf(1.0);
//                    }
//                } else {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        if (jyjxyjyggxm.getGjjjfwy() == null) {
//                            jyjxyjyggxm.setGjjjfdf(0.0);
//                        } else {
//                            jyjxyjyggxm.setGjjjfdf((jyjxyjyggxm.getGjjjfwy() - minGjjjf) / (maxgJjjf - minGjjjf));
//                        }
//                    }
//                }
//
//                //国家级参与教师人次
//                Double maxGjjjs = calculateScoreMapper.getMax(majorCode, year, "pd_jxsp_jyjxyjyggxm", "gjjcyjssrc");
//                Double mingJjjs = calculateScoreMapper.getMin(majorCode, year, "pd_jxsp_jyjxyjyggxm", "gjjcyjssrc");
//                if ((maxGjjjs == null || mingJjjs == null) || (maxGjjjs.equals(mingJjjs) && maxGjjjs == 0)) {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        jyjxyjyggxm.setGjjcyjssdf(0.0);
//                    }
//                } else if (maxGjjjs.equals(mingJjjs)) {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        jyjxyjyggxm.setGjjcyjssdf(1.0);
//                    }
//                } else {
//                    for (JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms) {
//                        if (jyjxyjyggxm.getGjjcyjssrc() == null) {
//                            jyjxyjyggxm.setGjjcyjssdf(0.0);
//                        } else {
//                            jyjxyjyggxm.setGjjcyjssdf((jyjxyjyggxm.getGjjcyjssrc() - mingJjjs) / (maxGjjjs - mingJjjs));
//                        }
//                    }
//                }
//                for(JxspJyjxyjyggxm jyjxyjyggxm : jyjxyjyggxms){
//                    jyjxyjyggxm.setZtzydf((jyjxyjyggxm.getSbjxmsdf() + jyjxyjyggxm.getSbjjfdf() + jyjxyjyggxm.getSbjcyjssdf() +
//                            jyjxyjyggxm.getGjjxmsdf() + jyjxyjyggxm.getGjjjfdf() + jyjxyjyggxm.getGjjcyjssrc()) / 6.0);
//                }
//                calculateScoreMapper.setJxspJyjxyjyggxm(year, jyjxyjyggxms);
//            }
//
//        }


        //转专业情况
//        for (String majorCode : majorCodes) {
//            Double max = calculateScoreMapper.getZzyMax(majorCode, year);
//            Double min = calculateScoreMapper.getZzyMin(majorCode, year);
//            if ((max == null || min == null) || (max.equals(min) && max == 0)) {
//                calculateScoreMapper.setScore0("pd_zzyqk", majorCode, year);
//            } else if (max.equals(min)) {
//                calculateScoreMapper.setScore1("pd_zzyqk", majorCode, year);
//            } else {
//                List<Zzyqk> zzyqks = calculateScoreMapper.getZzyqk(majorCode, year);
//                for (Zzyqk zzyqk : zzyqks) {
//                    if (zzyqk.getZrjzc() == null) {
//                        zzyqk.setZtzydf(0.0);
//                    } else {
//                        zzyqk.setZtzydf((zzyqk.getZrjzc() - min) / (max - min));
//                    }
//                    calculateScoreMapper.setZzyqkScore(majorCode, year, zzyqks);
//                }
//            }
//        }
        ;


//        //科研水平
//        //主持科研项目
//        for (String majorCode : majorCodes) {
//            List<KyspZckyxm> zckyxms = calculateScoreMapper.getZckyxm(majorCode, year);
//
//            if (zckyxms != null) {
//                //横向项目数
//                Double maxHxxmxms = calculateScoreMapper.getMax(majorCode, year, "pd_kysp_zckyxm", "hxxmxms");
//                Double minHxxmxms = calculateScoreMapper.getMin(majorCode, year, "pd_kysp_zckyxm", "hxxmxms");
//                if ((maxHxxmxms == null || minHxxmxms == null) || (maxHxxmxms.equals(minHxxmxms) && maxHxxmxms == 0)) {
//                    for (KyspZckyxm zckyxm : zckyxms) {
//                        zckyxm.setHxxmsdf(0.0);
//                    }
//                } else if (maxHxxmxms.equals(minHxxmxms)) {
//                    for (KyspZckyxm zckyxm : zckyxms) {
//                        zckyxm.setHxxmsdf(1.0);
//                    }
//                } else {
//                    for (KyspZckyxm zckyxm : zckyxms) {
//                        if (zckyxm.getHxxmxms() == null) {
//                            zckyxm.setHxxmsdf(0.0);
//                        } else {
//                            zckyxm.setHxxmsdf((zckyxm.getHxxmxms() - minHxxmxms) / (maxHxxmxms - minHxxmxms));
//                        }
//                    }
//                }
//
//                //纵向项目数
//                Double maxZxxmxms = calculateScoreMapper.getMax(majorCode, year, "pd_kysp_zckyxm", "zxxmxms");
//                Double minZxxmxms = calculateScoreMapper.getMin(majorCode, year, "pd_kysp_zckyxm", "zxxmxms");
//                if ((maxZxxmxms == null || minZxxmxms == null) || (maxZxxmxms.equals(minZxxmxms) && maxZxxmxms == 0)) {
//                    for (KyspZckyxm zckyxm : zckyxms) {
//                        zckyxm.setZxxmsdf(0.0);
//                    }
//                } else if (maxZxxmxms.equals(minZxxmxms)) {
//                    for (KyspZckyxm zckyxm : zckyxms) {
//                        zckyxm.setZxxmsdf(1.0);
//                    }
//                } else {
//                    for (KyspZckyxm zckyxm : zckyxms) {
//                        if (zckyxm.getZxxmxms() == null) {
//                            zckyxm.setZxxmsdf(0.0);
//                        } else {
//                            zckyxm.setZxxmsdf((zckyxm.getZxxmxms() - minZxxmxms) / (maxZxxmxms - minZxxmxms));
//                        }
//                    }
//                }
//
//                //横向经费
//                Double maxHxjf = calculateScoreMapper.getMax(majorCode, year, "pd_kysp_zckyxm", "hxjfwy");
//                Double minHxjf = calculateScoreMapper.getMin(majorCode, year, "pd_kysp_zckyxm", "hxjfwy");
//                if ((maxHxjf == null || minHxjf == null) || (maxHxjf.equals(minHxjf) && maxHxjf == 0)) {
//                    for (KyspZckyxm zckyxm : zckyxms) {
//                        zckyxm.setHxjfdf(0.0);
//                    }
//                } else if (maxHxjf.equals(minHxjf)) {
//                    for (KyspZckyxm zckyxm : zckyxms) {
//                        zckyxm.setHxjfdf(1.0);
//                    }
//                } else {
//                    for (KyspZckyxm zckyxm : zckyxms) {
//                        if (zckyxm.getHxjfwy() == null) {
//                            zckyxm.setHxjfdf(0.0);
//                        } else {
//                            zckyxm.setHxjfdf((zckyxm.getHxjfwy() - minHxjf) / (maxHxjf - minHxjf));
//                        }
//                    }
//                }
//
//                //纵向经费
//                Double maxZxjf = calculateScoreMapper.getMax(majorCode, year, "pd_kysp_zckyxm", "zxjfwy");
//                Double minZxjf = calculateScoreMapper.getMin(majorCode, year, "pd_kysp_zckyxm", "zxjfwy");
//                if ((maxZxjf == null || minZxjf == null) || (maxZxjf.equals(minZxjf) && maxZxjf == 0)) {
//                    for (KyspZckyxm zckyxm : zckyxms) {
//                        zckyxm.setZxjfdf(0.0);
//                    }
//                } else if (maxZxjf.equals(minZxjf)) {
//                    for (KyspZckyxm zckyxm : zckyxms) {
//                        zckyxm.setZxjfdf(1.0);
//                    }
//                } else {
//                    for (KyspZckyxm zckyxm : zckyxms) {
//                        if (zckyxm.getZxjfwy() == null) {
//                            zckyxm.setZxjfdf(0.0);
//                        } else {
//                            zckyxm.setZxjfdf((zckyxm.getZxjfwy() - minZxjf) / (maxZxjf - minZxjf));
//                        }
//                    }
//                }
//                for(KyspZckyxm zckyxm : zckyxms){
//                    zckyxm.setZtzydf((zckyxm.getHxxmsdf()+zckyxm.getZxxmsdf()+zckyxm.getHxjfdf()+zckyxm.getZxjfdf())/4);
//                }
//                calculateScoreMapper.setKyspZckyxmm(year, zckyxms);
//            }
//        }
//        //发表论文情况
//        for (String majorCode : majorCodes) {
//            List<KyspFblwqk> fblwqks = calculateScoreMapper.getKyspFblwqk(majorCode, year);
//            if (fblwqks != null) {
//                //SCI
//                Double maxSCI = calculateScoreMapper.getMax(majorCode, year,"pd_kysp_fblwqk","SCI");
//                Double minSCI = calculateScoreMapper.getMin(majorCode, year,"pd_kysp_fblwqk","SCI");
//                if ((maxSCI == null || minSCI == null) || (maxSCI.equals(minSCI) && maxSCI == 0)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setScidf(0.0);
//                    }
//                } else if (maxSCI.equals(minSCI)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setScidf(1.0);
//                    }
//                } else {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        if (fblwqk.getSci() == null) {
//                            fblwqk.setScidf(0.0);
//                        } else {
//                            fblwqk.setScidf((fblwqk.getSci() - minSCI) / (maxSCI - minSCI));
//                        }
//                    }
//                }
//                //SSCI
//                Double maxSSCI = calculateScoreMapper.getMax(majorCode, year,"pd_kysp_fblwqk","SSCI");
//                Double minSSCI = calculateScoreMapper.getMin(majorCode, year,"pd_kysp_fblwqk","SSCI");
//                if ((maxSSCI == null || minSSCI == null) || (maxSSCI.equals(minSSCI) && maxSSCI == 0)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setSscidf(0.0);
//                    }
//                } else if (maxSSCI.equals(minSSCI)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setSscidf(1.0);
//                    }
//                } else {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        if (fblwqk.getSsci() == null) {
//                            fblwqk.setSscidf(0.0);
//                        } else {
//                            fblwqk.setSscidf((fblwqk.getSsci() - minSSCI) / (maxSSCI - minSSCI));
//                        }
//                    }
//                }
//
//                //EI
//                Double maxEI = calculateScoreMapper.getMax(majorCode, year,"pd_kysp_fblwqk","EI");
//                Double minEI = calculateScoreMapper.getMin(majorCode, year,"pd_kysp_fblwqk","EI");
//                if ((maxEI == null || minEI == null) || (maxEI.equals(minEI) && maxEI == 0)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setEidf(0.0);
//                    }
//                } else if (maxEI.equals(minEI)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setEidf(1.0);
//                    }
//                } else {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        if (fblwqk.getEi() == null) {
//                            fblwqk.setEidf(0.0);
//                        } else {
//                            fblwqk.setEidf((fblwqk.getEi() - minEI) / (maxEI - minEI));
//                        }
//                    }
//                }
//
//                //CSCD
//                Double maxCSCD = calculateScoreMapper.getMax(majorCode, year,"pd_kysp_fblwqk","CSCD");
//                Double minCSCD = calculateScoreMapper.getMin(majorCode, year,"pd_kysp_fblwqk","CSCD");
//                if ((maxCSCD == null || minCSCD == null) || (maxCSCD.equals(minCSCD) && maxCSCD == 0)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setCscddf(0.0);
//                    }
//                } else if (maxCSCD.equals(minCSCD)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setCscddf(1.0);
//                    }
//                } else {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        if (fblwqk.getCscd() == null) {
//                            fblwqk.setCscddf(0.0);
//                        } else {
//                            fblwqk.setCscddf((fblwqk.getCscd() - minCSCD) / (maxCSCD - minCSCD));
//                        }
//                    }
//                }
//
//                //CSSCI
//                Double maxCSSCI = calculateScoreMapper.getMax(majorCode, year,"pd_kysp_fblwqk","CSSCI");
//                Double minCSSCI = calculateScoreMapper.getMin(majorCode, year,"pd_kysp_fblwqk","CSSCI");
//                if ((maxCSSCI == null || minCSSCI == null) || (maxCSSCI.equals(minCSSCI) && maxCSSCI == 0)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setCsscidf(0.0);
//                    }
//                } else if (maxCSSCI.equals(minCSSCI)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setCsscidf(1.0);
//                    }
//                } else {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        if (fblwqk.getCssci() == null) {
//                            fblwqk.setCsscidf(0.0);
//                        } else {
//                            fblwqk.setCsscidf((fblwqk.getCssci() - minCSSCI) / (maxCSSCI - minCSSCI));
//                        }
//                    }
//                }
//
//                //AHCI
//                Double maxAHCI = calculateScoreMapper.getMax(majorCode, year,"pd_kysp_fblwqk","AHCI");
//                Double minAHCI = calculateScoreMapper.getMin(majorCode, year,"pd_kysp_fblwqk","AHCI");
//                if ((maxAHCI == null || minAHCI == null) || (maxAHCI.equals(minAHCI) && maxAHCI == 0)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setAhcidf(0.0);
//                    }
//                } else if (maxAHCI.equals(minAHCI)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setAhcidf(1.0);
//                    }
//                } else {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        if (fblwqk.getAhci() == null) {
//                            fblwqk.setAhcidf(0.0);
//                        } else {
//                            fblwqk.setAhcidf((fblwqk.getAhci() - minAHCI) / (maxAHCI - minAHCI));
//                        }
//                    }
//                }
//
//                //ISTP
//                Double maxISTP = calculateScoreMapper.getMax(majorCode, year,"pd_kysp_fblwqk","ISTP");
//                Double minISTP = calculateScoreMapper.getMin(majorCode, year,"pd_kysp_fblwqk","ISTP");
//                if ((maxISTP == null || minISTP == null) || (maxISTP.equals(minISTP) && maxISTP == 0)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setIstpdf(0.0);
//                    }
//                } else if (maxISTP.equals(minISTP)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setIstpdf(1.0);
//                    }
//                } else {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        if (fblwqk.getIstp() == null) {
//                            fblwqk.setIstpdf(0.0);
//                        } else {
//                            fblwqk.setIstpdf((fblwqk.getIstp() - minISTP) / (maxISTP - minISTP));
//                        }
//                    }
//                }
//
//                //CPCI
//                Double maxCPCI = calculateScoreMapper.getMax(majorCode, year,"pd_kysp_fblwqk","CPCI");
//                Double minCPCI = calculateScoreMapper.getMin(majorCode, year,"pd_kysp_fblwqk","CPCI");
//                if ((maxCPCI == null || minCPCI == null) || (maxCPCI.equals(minCPCI) && maxCPCI == 0)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setCpcidf(0.0);
//                    }
//                } else if (maxCPCI.equals(minCPCI)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setCpcidf(1.0);
//                    }
//                } else {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        if (fblwqk.getCpci() == null) {
//                            fblwqk.setCpcidf(0.0);
//                        } else {
//                            fblwqk.setCpcidf((fblwqk.getCpci() - minCPCI) / (maxCPCI - minCPCI));
//                        }
//                    }
//                }
//                //bdzwhxqk
//                Double maxBdzwhxqk = calculateScoreMapper.getMax(majorCode, year,"pd_kysp_fblwqk","bdzwhxqk");
//                Double minBdzwhxqk = calculateScoreMapper.getMin(majorCode, year,"pd_kysp_fblwqk","bdzwhxqk");
//                if ((maxBdzwhxqk == null || minBdzwhxqk == null) || (maxBdzwhxqk.equals(minBdzwhxqk) && maxBdzwhxqk == 0)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setBdzwhxqkdf(0.0);
//                    }
//                } else if (maxBdzwhxqk.equals(minBdzwhxqk)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setBdzwhxqkdf(1.0);
//                    }
//                } else {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        if (fblwqk.getBdzwhxqk() == null) {
//                            fblwqk.setBdzwhxqkdf(0.0);
//                        } else {
//                            fblwqk.setBdzwhxqkdf((fblwqk.getBdzwhxqk() - minBdzwhxqk) / (maxBdzwhxqk - minBdzwhxqk));
//                        }
//                    }
//                }
//
//                //qtqk
//                Double maxQtqk = calculateScoreMapper.getMax(majorCode, year,"pd_kysp_fblwqk","qtqk");
//                Double minQtqk = calculateScoreMapper.getMin(majorCode, year,"pd_kysp_fblwqk","qtqk");
//                if ((maxQtqk == null || minQtqk == null) || (maxQtqk.equals(minQtqk) && maxQtqk == 0)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setQtqkdf(0.0);
//                    }
//                } else if (maxQtqk.equals(minQtqk)) {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        fblwqk.setQtqkdf(1.0);
//                    }
//                } else {
//                    for (KyspFblwqk fblwqk : fblwqks) {
//                        if (fblwqk.getQtqk() == null) {
//                            fblwqk.setQtqkdf(0.0);
//                        } else {
//                            fblwqk.setQtqkdf((fblwqk.getQtqk() - minQtqk) / (maxQtqk - minQtqk));
//                        }
//                    }
//                }
//            }
//            for (KyspFblwqk fblwqk : fblwqks) {
//                fblwqk.setZtzydf((fblwqk.getScidf() + fblwqk.getSscidf()+fblwqk.getEidf()+ fblwqk.getCscddf()+ fblwqk.getCsscidf()+
//                        fblwqk.getAhcidf() + fblwqk.getIstpdf() + fblwqk.getCpcidf() + fblwqk.getBdzwhxqkdf() + fblwqk.getQtqkdf()) / 10.0);
//            }
//            calculateScoreMapper.setKyspFblwqk(year, fblwqks);
//        }

//        //专利专著
//        for (String majorCode : majorCodes) {
//            List<KyspZlzz> zlzzs = calculateScoreMapper.getZlzz(majorCode, year);
//            //专利
//            if (zlzzs != null) {
//            Double maxZlzs = calculateScoreMapper.getMax(majorCode, year,"pd_kysp_zlzz","zlzs");
//            Double minZlzs = calculateScoreMapper.getMin(majorCode, year,"pd_kysp_zlzz","zlzs");
//                if ((maxZlzs == null || minZlzs == null) || (maxZlzs.equals(minZlzs) && maxZlzs == 0)) {
//                    for (KyspZlzz zlzz : zlzzs) {
//                        zlzz.setZldf(0.0);
//                    }
//                } else if (maxZlzs.equals(minZlzs)) {
//                    for (KyspZlzz zlzz : zlzzs) {
//                        zlzz.setZldf(1.0);
//                    }
//                } else {
//                    for (KyspZlzz zlzz : zlzzs) {
//                        if (zlzz.getZlzs() == null) {
//                            zlzz.setZldf(0.0);
//                        } else {
//                            zlzz.setZldf((zlzz.getZlzs() - minZlzs) / (maxZlzs - minZlzs));
//                        }
//                    }
//                }
//                //专著
//                Double maxZzzs = calculateScoreMapper.getMax(majorCode, year,"pd_kysp_zlzz","zzzs");
//                Double minZzzs = calculateScoreMapper.getMin(majorCode, year,"pd_kysp_zlzz","zzzs");
//                if ((maxZzzs == null || minZzzs == null) || (maxZzzs.equals(minZzzs) && maxZzzs == 0)) {
//                    for (KyspZlzz zlzz : zlzzs) {
//                        zlzz.setZzdf(0.0);
//                    }
//                } else if (maxZzzs.equals(minZzzs)) {
//                    for (KyspZlzz zlzz : zlzzs) {
//                        zlzz.setZzdf(1.0);
//                    }
//                } else {
//                    for (KyspZlzz zlzz : zlzzs) {
//                        if (zlzz.getZzzs() == null) {
//                            zlzz.setZzdf(0.0);
//                        } else {
//                            zlzz.setZzdf((zlzz.getZzzs() - minZzzs) / (maxZzzs - minZzzs));
//                        }
//                    }
//                }
//
//                //译著或辞书
//                Double maxYzhcs = calculateScoreMapper.getMax(majorCode, year,"pd_kysp_zlzz","yzhcs");
//                Double minYzhcs = calculateScoreMapper.getMin(majorCode, year,"pd_kysp_zlzz","yzhcs");
//                if ((maxYzhcs == null || minYzhcs == null) || (maxYzhcs.equals(minYzhcs) && maxYzhcs == 0)) {
//                    for (KyspZlzz zlzz : zlzzs) {
//                        zlzz.setYzhcsdf(0.0);
//                    }
//                } else if (maxYzhcs.equals(minYzhcs)) {
//                    for (KyspZlzz zlzz : zlzzs) {
//                        zlzz.setYzhcsdf(1.0);
//                    }
//                } else {
//                    for (KyspZlzz zlzz : zlzzs) {
//                        if (zlzz.getYzhcs() == null) {
//                            zlzz.setYzhcsdf(0.0);
//                        } else {
//                            zlzz.setYzhcsdf((zlzz.getYzhcs() - minYzhcs) / (maxYzhcs - minYzhcs));
//                        }
//                    }
//                }
//            }
//            for (KyspZlzz zlzz : zlzzs) {
//                zlzz.setZtzydf((zlzz.getZldf() +zlzz.getZzdf() +zlzz.getYzhcsdf())/3);
//            }
//            calculateScoreMapper.setKyspZlzz(year, zlzzs);
//        }

////        专业实验教学校内场所情况
//        for (String majorCode : majorCodes) {
//            List<Zysyjxxncsqk> zysyjxxncsqks = calculateScoreMapper.getZysyjxxncsqk(majorCode, year);
//            if (zysyjxxncsqks != null && !zysyjxxncsqks.isEmpty()) {
//                System.out.println("=====================================");
//                System.out.println(zysyjxxncsqks.toString());
//                //基础实验室数量
//                Double maxJcsl = calculateScoreMapper.getMax(majorCode, year, "pd_zysyjxxncsqk", "jcsyssl");
//                Double minJcsl = calculateScoreMapper.getMin(majorCode, year, "pd_zysyjxxncsqk", "jcsyssl");
//                if ((maxJcsl == null || minJcsl == null) || (maxJcsl.equals(minJcsl) && maxJcsl == 0)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setJcsldf(0.0);
//                    }
//                } else if (maxJcsl.equals(minJcsl)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setJcsldf(1.0);
//                    }
//                } else {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        if (zysyjxxncsqk.getJcsyssl() == null) {
//                            zysyjxxncsqk.setJcsldf(0.0);
//                        } else {
//                            zysyjxxncsqk.setJcsldf((zysyjxxncsqk.getJcsyssl() - minJcsl) / (maxJcsl - minJcsl));
//                        }
//                    }
//                }
//
//                //基础实验室面积
//                Double maxJcmj = calculateScoreMapper.getMax(majorCode, year, "pd_zysyjxxncsqk", "jcsysmjpfm");
//                Double minJcmj = calculateScoreMapper.getMin(majorCode, year, "pd_zysyjxxncsqk", "jcsysmjpfm");
//                if ((maxJcmj == null || minJcmj == null) || (maxJcmj.equals(minJcmj) && maxJcmj == 0)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setJcmjdf(0.0);
//                    }
//                } else if (maxJcmj.equals(minJcmj)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setJcmjdf(1.0);
//                    }
//                } else {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        if (zysyjxxncsqk.getJcsysmjpfm() == null) {
//                            zysyjxxncsqk.setJcmjdf(0.0);
//                        } else {
//                            zysyjxxncsqk.setJcmjdf((zysyjxxncsqk.getJcsysmjpfm() - minJcmj) / (maxJcmj - minJcmj));
//                        }
//                    }
//                }
//
//                //基础实验室设备台套数
//                Double maxJcsbs = calculateScoreMapper.getMax(majorCode, year, "pd_zysyjxxncsqk", "jcsyssbtts");
//                Double minJcsbs = calculateScoreMapper.getMin(majorCode, year, "pd_zysyjxxncsqk", "jcsyssbtts");
//                if ((maxJcsbs == null || minJcsbs == null) || (maxJcsbs.equals(minJcsbs) && maxJcsbs == 0)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setJcsbsdf(0.0);
//                    }
//                } else if (maxJcsbs.equals(minJcsbs)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setJcsbsdf(1.0);
//                    }
//                } else {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        if (zysyjxxncsqk.getJcsyssbtts() == null) {
//                            zysyjxxncsqk.setJcsbsdf(0.0);
//                        } else {
//                            zysyjxxncsqk.setJcsbsdf((zysyjxxncsqk.getJcsyssbtts() - minJcsbs) / (maxJcsbs - minJcsbs));
//                        }
//                    }
//                }
//
//                //基础实验室设备值（元）
//                Double maxJcsbz = calculateScoreMapper.getMax(majorCode, year, "pd_zysyjxxncsqk", "jcsyssbzy");
//                Double minJcsbz = calculateScoreMapper.getMin(majorCode, year, "pd_zysyjxxncsqk", "jcsyssbzy");
//                if ((maxJcsbz == null || minJcsbz == null) || (maxJcsbz.equals(minJcsbz) && maxJcsbz == 0)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setJcjzdf(0.0);
//                    }
//                } else if (maxJcsbz.equals(minJcsbz)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setJcjzdf(1.0);
//                    }
//                } else {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        if (zysyjxxncsqk.getJcsyssbzy() == null) {
//                            zysyjxxncsqk.setJcjzdf(0.0);
//                        } else {
//                            zysyjxxncsqk.setJcjzdf((zysyjxxncsqk.getJcsyssbzy() - minJcsbz) / (maxJcsbz - minJcsbz));
//                        }
//                    }
//                }
//                //专业实验室数量
//                Double maxZysl = calculateScoreMapper.getMax(majorCode, year, "pd_zysyjxxncsqk", "zysyssl");
//                Double minZysl = calculateScoreMapper.getMin(majorCode, year, "pd_zysyjxxncsqk", "zysyssl");
//                if ((maxZysl == null || minZysl == null) || (maxZysl.equals(minZysl) && maxZysl == 0)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setZysldf(0.0);
//                    }
//                } else if (maxZysl.equals(minZysl)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setZysldf(1.0);
//                    }
//                } else {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        if (zysyjxxncsqk.getZysyssl() == null) {
//                            zysyjxxncsqk.setZysldf(0.0);
//                        } else {
//                            zysyjxxncsqk.setZysldf((zysyjxxncsqk.getZysyssl() - minZysl) / (maxZysl - minZysl));
//                        }
//                    }
//                }
//
//                //专业实验室面积（平方米）
//                Double maxZymj = calculateScoreMapper.getMax(majorCode, year, "pd_zysyjxxncsqk", "zysysmjpfm");
//                Double minZymj = calculateScoreMapper.getMin(majorCode, year, "pd_zysyjxxncsqk", "zysysmjpfm");
//                if ((maxZymj == null || minZymj == null) || (maxZymj.equals(minZymj) && maxZymj == 0)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setZymjdf(0.0);
//                    }
//                } else if (maxZymj.equals(minZymj)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setZymjdf(1.0);
//                    }
//                } else {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        if (zysyjxxncsqk.getZysysmjpfm() == null) {
//                            zysyjxxncsqk.setZymjdf(0.0);
//                        } else {
//                            zysyjxxncsqk.setZymjdf((zysyjxxncsqk.getZysysmjpfm() - minZymj) / (maxZymj - minZymj));
//                        }
//                    }
//                }
//
//                //专业实验室设备台套数
//                Double maxZysbs = calculateScoreMapper.getMax(majorCode, year, "pd_zysyjxxncsqk", "zysyssbtts");
//                Double minZysbs = calculateScoreMapper.getMin(majorCode, year, "pd_zysyjxxncsqk", "zysyssbtts");
//                if ((maxZysbs == null || minZysbs == null) || (maxZysbs.equals(minZysbs) && maxZysbs == 0)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setZysbsdf(0.0);
//                    }
//                } else if (maxZysbs.equals(minZysbs)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setZysbsdf(1.0);
//                    }
//                } else {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        if (zysyjxxncsqk.getZysyssbtts() == null) {
//                            zysyjxxncsqk.setZysbsdf(0.0);
//                        } else {
//                            zysyjxxncsqk.setZysbsdf((zysyjxxncsqk.getZysyssbtts() - minZysbs) / (maxZysbs - minZysbs));
//                        }
//                    }
//                }
//
//                //专业实验室设备值（元）
//                Double maxZysbz = calculateScoreMapper.getMax(majorCode, year, "pd_zysyjxxncsqk", "zysyssbzy");
//                Double minZysbz = calculateScoreMapper.getMin(majorCode, year, "pd_zysyjxxncsqk", "zysyssbzy");
//                if ((maxZysbz == null || minZysbz == null) || (maxZysbz.equals(minZysbz) && maxZysbz == 0)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setZyjzdf(0.0);
//                    }
//                } else if (maxZysbz.equals(minZysbz)) {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        zysyjxxncsqk.setZyjzdf(1.0);
//                    }
//                } else {
//                    for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks) {
//                        if (zysyjxxncsqk.getZysyssbzy() == null) {
//                            zysyjxxncsqk.setZyjzdf(0.0);
//                        } else {
//                            zysyjxxncsqk.setZyjzdf((zysyjxxncsqk.getZysyssbzy() - minZysbz) / (maxZysbz - minZysbz));
//                        }
//                    }
//                }
//
//                for (Zysyjxxncsqk zysyjxxncsqk : zysyjxxncsqks){
//                    zysyjxxncsqk.setZtzydf((zysyjxxncsqk.getJcsldf()+ zysyjxxncsqk.getJcmjdf() + zysyjxxncsqk.getJcsbsdf() + zysyjxxncsqk.getJcjzdf() +
//                            zysyjxxncsqk.getZysldf()+ zysyjxxncsqk.getZymjdf() + zysyjxxncsqk.getZysbsdf() + zysyjxxncsqk.getZyjzdf() ) / 8.0);
//                }
//                calculateScoreMapper.setZysyjxxncsqk(year, zysyjxxncsqks);
//            }
//        }


        //实习实践实训基地情况
//        for (String majorCode : majorCodes) {
//            Double maxJdzs = calculateScoreMapper.getMax(majorCode, year,"pd_sxjd_sxsjsxjdqk","jdzs");
//            Double minJdzs = calculateScoreMapper.getMin(majorCode, year,"pd_sxjd_sxsjsxjdqk","jdzs");
//            List<SxjdSxsjsxjdqk> sxjdSxsjsxjdqks = calculateScoreMapper.getSxjdSxsjsxjdqk(majorCode, year);
//            if (sxjdSxsjsxjdqks != null) {
//                if ((maxJdzs == null || minJdzs == null) || (maxJdzs.equals(minJdzs) && maxJdzs == 0)) {
//                    for (SxjdSxsjsxjdqk sxjdSxsjsxjdqk : sxjdSxsjsxjdqks) {
//                        sxjdSxsjsxjdqk.setJdsldf(0.0);
//                    }
//                } else if (maxJdzs.equals(minJdzs)) {
//                    for (SxjdSxsjsxjdqk sxjdSxsjsxjdqk : sxjdSxsjsxjdqks) {
//                        sxjdSxsjsxjdqk.setJdsldf(1.0);
//                    }
//                } else {
//                    for (SxjdSxsjsxjdqk sxjdSxsjsxjdqk : sxjdSxsjsxjdqks) {
//                        if (sxjdSxsjsxjdqk.getJdzs() == null) {
//                            sxjdSxsjsxjdqk.setJdsldf(0.0);
//                        } else {
//                            sxjdSxsjsxjdqk.setJdsldf((sxjdSxsjsxjdqk.getJdzs() - minJdzs) / (maxJdzs - minJdzs));
//                        }
//                    }
//                }
//
//                Double maxDnjnxszrs = calculateScoreMapper.getMax(majorCode, year,"pd_sxjd_sxsjsxjdqk","dnjnxszrs");
//                Double minDnjnxszrs = calculateScoreMapper.getMin(majorCode, year,"pd_sxjd_sxsjsxjdqk","dnjnxszrs");
//                if ((maxDnjnxszrs == null || minDnjnxszrs == null) || (maxDnjnxszrs.equals(minDnjnxszrs) && maxDnjnxszrs == 0)) {
//                    for (SxjdSxsjsxjdqk sxjdSxsjsxjdqk : sxjdSxsjsxjdqks) {
//                        sxjdSxsjsxjdqk.setDnjnxszrsdf(0.0);
//                    }
//                } else if (maxDnjnxszrs.equals(minDnjnxszrs)) {
//                    for (SxjdSxsjsxjdqk sxjdSxsjsxjdqk : sxjdSxsjsxjdqks) {
//                        sxjdSxsjsxjdqk.setDnjnxszrsdf(1.0);
//                    }
//                } else {
//                    for (SxjdSxsjsxjdqk sxjdSxsjsxjdqk : sxjdSxsjsxjdqks) {
//                        if (sxjdSxsjsxjdqk.getDnjnxszrs() == null) {
//                            sxjdSxsjsxjdqk.setDnjnxszrsdf(0.0);
//                        } else {
//                            sxjdSxsjsxjdqk.setDnjnxszrsdf((sxjdSxsjsxjdqk.getDnjnxszrs() - minDnjnxszrs) / (maxDnjnxszrs - minDnjnxszrs));
//                        }
//                    }
//                }
//                for (SxjdSxsjsxjdqk sxjdSxsjsxjdqk : sxjdSxsjsxjdqks) {
//                    sxjdSxsjsxjdqk.setZtzydf((sxjdSxsjsxjdqk.getJdsldf() + sxjdSxsjsxjdqk.getDnjnxszrsdf())/2);
//                }
//                calculateScoreMapper.setSxjdSxsjsxjdqk(year, sxjdSxsjsxjdqks);
//            }
//        }

        //参加创新创业训练计划
//        for (String majorCode : majorCodes) {
//            List<JydhCjcxcyxljh> jydhCjcxcyxljhs = calculateScoreMapper.getJydhCjcxcyxljh(majorCode, year);
//
//            Double maxGjjsl = calculateScoreMapper.getMax(majorCode, year,"pd_jydh_cjcxcyxljh","gjjsl");
//            Double minGjjsl = calculateScoreMapper.getMin(majorCode, year,"pd_jydh_cjcxcyxljh","gjjsl");
//            if (jydhCjcxcyxljhs != null) {
//                if ((maxGjjsl == null || minGjjsl == null) || (maxGjjsl.equals(minGjjsl) && maxGjjsl == 0)) {
//                    for (JydhCjcxcyxljh jydhCjcxcyxljh : jydhCjcxcyxljhs) {
//                        jydhCjcxcyxljh.setGjjsldf(0.0);
//                    }
//                } else if (maxGjjsl.equals(minGjjsl)) {
//                    for (JydhCjcxcyxljh jydhCjcxcyxljh : jydhCjcxcyxljhs) {
//                        jydhCjcxcyxljh.setGjjsldf(1.0);
//                    }
//                } else {
//                    for (JydhCjcxcyxljh jydhCjcxcyxljh : jydhCjcxcyxljhs) {
//                        if (jydhCjcxcyxljh.getGjjsl() == null) {
//                            jydhCjcxcyxljh.setGjjsldf(0.0);
//                        } else {
//                            jydhCjcxcyxljh.setGjjsldf((jydhCjcxcyxljh.getGjjsl() - minGjjsl) / (maxGjjsl - minGjjsl));
//                        }
//                    }
//                }
//
//                Double maxSbjdl = calculateScoreMapper.getMax(majorCode, year,"pd_jydh_cjcxcyxljh","sbjsl");
//                Double minSbjsl = calculateScoreMapper.getMin(majorCode, year,"pd_jydh_cjcxcyxljh","sbjsl");
//                if ((maxSbjdl == null || minSbjsl == null) || (maxSbjdl.equals(minSbjsl) && maxSbjdl == 0)) {
//                    for (JydhCjcxcyxljh jydhCjcxcyxljh : jydhCjcxcyxljhs) {
//                        jydhCjcxcyxljh.setSbjsldf(0.0);
//                    }
//                } else if (maxSbjdl.equals(minSbjsl)) {
//                    for (JydhCjcxcyxljh jydhCjcxcyxljh : jydhCjcxcyxljhs) {
//                        jydhCjcxcyxljh.setSbjsldf(1.0);
//                    }
//                } else {
//                    for (JydhCjcxcyxljh jydhCjcxcyxljh : jydhCjcxcyxljhs) {
//                        if (jydhCjcxcyxljh.getSbjsl() == null) {
//                            jydhCjcxcyxljh.setSbjsldf(0.0);
//                        } else {
//                            jydhCjcxcyxljh.setSbjsldf((jydhCjcxcyxljh.getSbjsl() - minSbjsl) / (maxSbjdl - minSbjsl));
//                        }
//                    }
//                }
//                for (JydhCjcxcyxljh jydhCjcxcyxljh : jydhCjcxcyxljhs) {
//                    jydhCjcxcyxljh.setZtzydf((jydhCjcxcyxljh.getGjjsldf() + jydhCjcxcyxljh.getSbjsldf())/2);
//                }
//                calculateScoreMapper.setJydhCjcxcyxljh(year, jydhCjcxcyxljhs);
//            }
//        }


        //参加教师科研情况
//        for (String majorCode : majorCodes) {
//            List<JyhdCjjskyqk> jyhdCjjskyqks = calculateScoreMapper.getJyhdCjjskyqk(majorCode, year);
//
//            Double maxXssl = calculateScoreMapper.getMax(majorCode, year, "pd_jyhd_cjjskyqk", "xssl");
//            Double minXssl = calculateScoreMapper.getMin(majorCode, year, "pd_jyhd_cjjskyqk", "xssl");
//            if (jyhdCjjskyqks != null) {
//                if ((maxXssl == null || minXssl == null) || (maxXssl.equals(minXssl) && maxXssl == 0)) {
//                    for (JyhdCjjskyqk jyhdCjjskyqk : jyhdCjjskyqks) {
//                        jyhdCjjskyqk.setXssldf(0.0);
//                    }
//                } else if (maxXssl.equals(minXssl)) {
//                    for (JyhdCjjskyqk jyhdCjjskyqk : jyhdCjjskyqks) {
//                        jyhdCjjskyqk.setXssldf(1.0);
//                    }
//                } else {
//                    for (JyhdCjjskyqk jyhdCjjskyqk : jyhdCjjskyqks) {
//                        if (jyhdCjjskyqk.getXssl() == null) {
//                            jyhdCjjskyqk.setXssldf(0.0);
//                        } else {
//                            jyhdCjjskyqk.setXssldf((jyhdCjjskyqk.getXssl() - minXssl) / (maxXssl - minXssl));
//                        }
//                    }
//                }
//
//                Double maxXmsl = calculateScoreMapper.getMax(majorCode, year, "pd_jyhd_cjjskyqk", "xmsl");
//                Double minXmsl = calculateScoreMapper.getMin(majorCode, year, "pd_jyhd_cjjskyqk", "xmsl");
//                if ((maxXmsl == null || minXmsl == null) || (maxXmsl.equals(minXmsl) && maxXmsl == 0)) {
//                    for (JyhdCjjskyqk jyhdCjjskyqk : jyhdCjjskyqks) {
//                        jyhdCjjskyqk.setXmsldf(0.0);
//                    }
//                } else if (maxXmsl.equals(minXmsl)) {
//                    for (JyhdCjjskyqk jyhdCjjskyqk : jyhdCjjskyqks) {
//                        jyhdCjjskyqk.setXmsldf(1.0);
//                    }
//                } else {
//                    for (JyhdCjjskyqk jyhdCjjskyqk : jyhdCjjskyqks) {
//                        if (jyhdCjjskyqk.getXmsl() == null) {
//                            jyhdCjjskyqk.setXmsldf(0.0);
//                        } else {
//                            jyhdCjjskyqk.setXmsldf((jyhdCjjskyqk.getXmsl() - minXmsl) / (maxXmsl - minXmsl));
//                        }
//                    }
//                }
//                for (JyhdCjjskyqk jyhdCjjskyqk : jyhdCjjskyqks) {
//                    jyhdCjjskyqk.setZtzydf((jyhdCjjskyqk.getXssldf() + jyhdCjjskyqk.getXmsldf())/2);
//                }
//                calculateScoreMapper.setJyhdCjjskyqk(year, jyhdCjjskyqks);
//                }
//
//
//
//        }


//        //本科生交流情况
//        for (String majorCode : majorCodes) {
//            List<JyhdBksjlqk> bksjlqks = calculateScoreMapper.getBksjlqk(majorCode, year);
//            if (bksjlqks != null) {
//                //境外本专业外出交流
//                Double maxJwwc = calculateScoreMapper.getMax(majorCode, year, "pd_jyhd_bksjlqk", "jwbzywcjlxsrs");
//                Double minJwwc = calculateScoreMapper.getMin(majorCode, year, "pd_jyhd_bksjlqk", "jwbzywcjlxsrs");
//                if ((maxJwwc == null || minJwwc == null) || (maxJwwc.equals(minJwwc) && maxJwwc == 0)) {
//                    for (JyhdBksjlqk bksjlqk : bksjlqks) {
//                        bksjlqk.setJwwcdf(0.0);
//                    }
//                } else if (maxJwwc.equals(minJwwc)) {
//                    for (JyhdBksjlqk bksjlqk : bksjlqks) {
//                        bksjlqk.setJwwcdf(1.0);
//                    }
//                } else {
//                    for (JyhdBksjlqk bksjlqk : bksjlqks) {
//                        if (bksjlqk.getJwbzywcjlxsrs() == null) {
//                            bksjlqk.setJwwcdf(0.0);
//                        } else {
//                            bksjlqk.setJwwcdf((bksjlqk.getJwbzywcjlxsrs() - minJwwc) / (maxJwwc - minJwwc));
//                        }
//                    }
//                }
//
//                //境内本专业外出交流
//                Double maxJnwc = calculateScoreMapper.getMax(majorCode, year, "pd_jyhd_bksjlqk", "jnbzywcjlxsrs");
//                Double minJnwc = calculateScoreMapper.getMin(majorCode, year, "pd_jyhd_bksjlqk", "jnbzywcjlxsrs");
//                if ((maxJnwc == null || minJnwc == null) || (maxJnwc.equals(minJnwc) && maxJnwc == 0)) {
//                    for (JyhdBksjlqk bksjlqk : bksjlqks) {
//                        bksjlqk.setJnwcdf(0.0);
//                    }
//                } else if (maxJnwc.equals(minJnwc)) {
//                    for (JyhdBksjlqk bksjlqk : bksjlqks) {
//                        bksjlqk.setJnwcdf(1.0);
//                    }
//                } else {
//                    for (JyhdBksjlqk bksjlqk : bksjlqks) {
//                        if (bksjlqk.getJnbzywcjlxsrs() == null) {
//                            bksjlqk.setJnwcdf(0.0);
//                        } else {
//                            bksjlqk.setJnwcdf((bksjlqk.getJnbzywcjlxsrs() - minJnwc) / (maxJnwc - minJnwc));
//                        }
//                    }
//                }
//                //境外到本专业交流
//                Double maxJwdbzy = calculateScoreMapper.getMax(majorCode, year, "pd_jyhd_bksjlqk", "jwdbzyjlxsrs");
//                Double minJwdbzy = calculateScoreMapper.getMin(majorCode, year, "pd_jyhd_bksjlqk", "jwdbzyjlxsrs");
//                if ((maxJwdbzy == null || minJwdbzy == null) || (maxJwdbzy.equals(minJwdbzy) && maxJwdbzy == 0)) {
//                    for (JyhdBksjlqk bksjlqk : bksjlqks) {
//                        bksjlqk.setJwdbzydf(0.0);
//                    }
//                } else if (maxJwdbzy.equals(minJwdbzy)) {
//                    for (JyhdBksjlqk bksjlqk : bksjlqks) {
//                        bksjlqk.setJwdbzydf(1.0);
//                    }
//                } else {
//                    for (JyhdBksjlqk bksjlqk : bksjlqks) {
//                        if (bksjlqk.getJwdbzyjlxsrs() == null) {
//                            bksjlqk.setJwdbzydf(0.0);
//                        } else {
//                            bksjlqk.setJwdbzydf((bksjlqk.getJwdbzyjlxsrs() - minJwdbzy) / (maxJwdbzy - minJwdbzy));
//                        }
//                    }
//                }
//
//                //境内到本专业交流
//                Double maxJndbzy = calculateScoreMapper.getMax(majorCode, year, "pd_jyhd_bksjlqk", "jndbzyjlxsrs");
//                Double minJndbzy = calculateScoreMapper.getMin(majorCode, year, "pd_jyhd_bksjlqk", "jndbzyjlxsrs");
//                if ((maxJndbzy == null || minJndbzy == null) || (maxJndbzy.equals(minJndbzy) && maxJndbzy == 0)) {
//                    for (JyhdBksjlqk bksjlqk : bksjlqks) {
//                        bksjlqk.setJndbzydf(0.0);
//                    }
//                } else if (maxJndbzy.equals(minJndbzy)) {
//                    for (JyhdBksjlqk bksjlqk : bksjlqks) {
//                        bksjlqk.setJndbzydf(1.0);
//                    }
//                } else {
//                    for (JyhdBksjlqk bksjlqk : bksjlqks) {
//                        if (bksjlqk.getJnbzywcjlxsrs() == null) {
//                            bksjlqk.setJndbzydf(0.0);
//                        } else {
//                            bksjlqk.setJndbzydf((bksjlqk.getJndbzyjlxsrs() - minJndbzy) / (maxJndbzy - minJndbzy));
//                        }
//                    }
//                }
//                for (JyhdBksjlqk bksjlqk : bksjlqks) {
//                    bksjlqk.setZtzydf((bksjlqk.getJwwcdf() + bksjlqk.getJnwcdf()+ bksjlqk.getJwdbzydf() + bksjlqk.getJndbzydf())/ 4);
//                }
//                calculateScoreMapper.setJyhdBksjlqk(year, bksjlqks);
//            }
//        }

//        //学生发表论文情况
//        for (String majorCode : majorCodes) {
//            List<XxcxFblwqk> fblwqks = calculateScoreMapper.getFblwqk(majorCode, year);
//            if(fblwqks != null){
//                Double maxFblwsl = calculateScoreMapper.getMax(majorCode, year, "pd_xxcx_fblwqk", "fblwsl");
//                Double minFblwsl = calculateScoreMapper.getMin(majorCode, year, "pd_xxcx_fblwqk", "fblwsl");
//                if ((maxFblwsl == null || minFblwsl == null) || (maxFblwsl.equals(minFblwsl) && maxFblwsl == 0)) {
//                    for (XxcxFblwqk fblwqk : fblwqks) {
//                        fblwqk.setZtzydf(0.0);
//                    }
//                } else if (maxFblwsl.equals(minFblwsl)) {
//                    for (XxcxFblwqk fblwqk : fblwqks) {
//                        fblwqk.setZtzydf(1.0);
//                    }
//                } else {
//                    for (XxcxFblwqk fblwqk : fblwqks) {
//                        if (fblwqk.getFblwsl() == null) {
//                            fblwqk.setZtzydf(0.0);
//                        } else {
//                            fblwqk.setZtzydf((fblwqk.getFblwsl() - minFblwsl) / (maxFblwsl - minFblwsl));
//                        }
//                    }
//                }
//            }
//            calculateScoreMapper.setXxcxFblwqk(year, fblwqks);
//        }


//        //教师指导学生毕业综合训练情况
//        for (String majorCode : majorCodes) {
//            Double maxJsxsb = calculateScoreMapper.getMax(majorCode, year, "pd_byxl_jszdxsbyzhxlqk", "jsxsb");
//            Double minJsxsb = calculateScoreMapper.getMin(majorCode, year, "pd_byxl_jszdxsbyzhxlqk", "jsxsb");
//            List<ByxlJszdxsbyzhxlqk> jszdxsbyzhxlqks = calculateScoreMapper.getByxlJszdxsbyzhxlqk(majorCode, year);
//            if(jszdxsbyzhxlqks != null){
//                if ((maxJsxsb == null || minJsxsb == null) || (maxJsxsb.equals(minJsxsb) && maxJsxsb == 0)) {
//                    for (ByxlJszdxsbyzhxlqk jszdxsbyzhxlqk : jszdxsbyzhxlqks) {
//                        jszdxsbyzhxlqk.setZtzydf(0.0);
//                    }
//                } else if (maxJsxsb.equals(minJsxsb)) {
//                    for (ByxlJszdxsbyzhxlqk jszdxsbyzhxlqk : jszdxsbyzhxlqks) {
//                        jszdxsbyzhxlqk.setZtzydf(1.0);
//                    }
//                } else {
//                    for (ByxlJszdxsbyzhxlqk jszdxsbyzhxlqk : jszdxsbyzhxlqks) {
//                        if (jszdxsbyzhxlqk.getJsxsb() == null) {
//                            jszdxsbyzhxlqk.setZtzydf(0.0);
//                        } else {
//                            jszdxsbyzhxlqk.setZtzydf((jszdxsbyzhxlqk.getJsxsb() - minJsxsb) / (maxJsxsb - minJsxsb));
//                        }
//                    }
//                }
//                calculateScoreMapper.setByxlJszdxsbyzhxlqk(year, jszdxsbyzhxlqks);
//            }
//        }


    }

 */